package com.ankiang.treeprint.base;

import com.ankiang.treeprint.view.TRListener;
import com.qmuiteam.qmui.arch.QMUIFragment;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.ankiang.treeprint.manager.QDUpgradeManager;

/**
 * Created by cgspine on 2018/1/7.
 */

public abstract class BaseFragment extends QMUIFragment {

    protected TRListener callback;
    public BaseFragment() {
    }

    @Override
    protected int backViewInitOffset() {
        return QMUIDisplayHelper.dp2px(getContext(), 100);
    }

    @Override
    public void onResume() {
        super.onResume();
        QDUpgradeManager.getInstance(getContext()).runUpgradeTipTaskIfExist(getActivity());
    }

    public void startFragment(QMUIFragment fragment){
        super.startFragment(fragment);
    }

    public String V(int id) {
        String v = getResources().getString(id);
        return v;
    }


    public void setCallback(TRListener listener) {
        this.callback = listener;
    }
    public boolean runCallback(int id){
        if(this.callback !=null) {
            this.callback.afterOperation(id);
            return true;
        }
        return false;
    }
    @Override
    protected void popBackStack(){


        super.popBackStack();
    }
}
